package com.xupypr.surgery.server;

import java.util.Date;
import java.util.List;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.xupypr.surgery.client.IAdminPanelDispatcher;
import com.xupypr.surgery.client.objects.BlogEntry;

@SuppressWarnings("serial")
public class AdminPanelDispatcher extends RemoteServiceServlet implements IAdminPanelDispatcher{

	public void createEntry(BlogEntry entry) {
		if (entry.getId()!=null) {
			Persistence.updateEntry(entry);
		} else {
			Persistence.createEntry(entry);
		}
	}

	public List<BlogEntry> getEntries(Date borderDate, Long quantity) {
		return Persistence.getEntries(borderDate, quantity);
	}

	public BlogEntry getEntry(Long id) {
		return Persistence.getEntry(id);
	}
	
	public void deleteEntry(Long id) {
		Persistence.deleteEntry(id);
	}

}
